←Select platform

ToAnnObject(DicomDataSet,List<IDicomAnnotationObject>) Method

Summary

Converts a list of Leadtools.IDicomAnnotationObject into a list of Leadtools.Annotations.Core.AnnObject objects.

Syntax

C#
VB
C++
public List<AnnObject> ToAnnObject(  
   Leadtools.Dicom.DicomDataSet ds, 
   List<IDicomAnnotationObject> dicomAnnotationObjectList 
) 
  
Public Overloads Function ToAnnObject( _ 
   ByVal ds As Leadtools.Dicom.DicomDataSet, _ 
   ByVal dicomAnnotationObjectList As List(Of IDicomAnnotationObject) _ 
) As List(Of AnnObject) 
public: 
List<AnnObject^>^ ToAnnObject(  
   Leadtools.Dicom.DicomDataSet^ ds, 
   List<IDicomAnnotationObject^>^ dicomAnnotationObjectList 
)  

Parameters

ds
A Leadtools.Dicom.DicomDataSet that contains the Graphic Group Sequence (0070,0234).

dicomAnnotationObjectList
The a list of Leadtools.IDicomAnnotationObject to be converted.

Return Value

A list of Leadtools.Annotations.Core.AnnObject

Remarks

This function converts a list of DICOM Annotation Objects (text, graphic, and compound graphic) Leadtools.IDicomAnnotationObject into a list of LEAD annotation objects (Leadtools.Annotations.Core.AnnObject). Note that dicomAnnotationObjectList can contain Leadtools.IDicomAnnotationObject that are grouped together, to return a single Leadtools.Annotations.Core.AnnObject. For example, the Leadtools.Annotations.Core.AnnPolyRulerObject, Leadtools.Annotations.Core.AnnProtractorObject, and the Leadtools.Annotations.Core.AnnCrossProductObject are all stored as one or more 'grouped' Leadtools.Dicom.DicomCompoundGraphic objects.

Example

This example does the following:

  1. Creates two grouped rulers (Leadtools.Dicom.DicomCompoundGraphic)
  2. Creates a converter
  3. Converts the grouped rulers to a LEAD Leadtools.Annotations.Core.AnnPolyRulerObject
    C#
    VB
    using Leadtools; 
    using Leadtools.Dicom; 
    using Leadtools.Dicom.Annotations.Core; 
    using Leadtools.Annotations.Core; 
     
    private List<AnnObject> DicomAnnotationsUtilities_ToAnnObject2() 
    { 
       // Set up the DicomAnnotationsUtilities converter 
       DicomAnnotationsUtilities du = new DicomAnnotationsUtilities(); 
       du.ImageDpiX = 96.0; 
       du.ImageDpiY = 96.0; 
       du.DisplayWidth = 200; 
       du.DisplayHeight = 200; 
       du.LayerName = "Layer 0"; 
       du.CompoundGraphicInstanceId = 100; 
       du.GraphicGroupId = 123; 
     
       // LineStyle -- user for both rulers 
       DicomLineStyle lineStyle = new DicomLineStyle(); 
       lineStyle = new DicomLineStyle(); 
       lineStyle.LineOptions = DicomAnnotationLineOptions.None; 
       lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off; 
       lineStyle.Shadow.ShadowOpacity = 0.0f; 
       lineStyle.Shadow.ShadowOffsetX = 0.0f; 
       lineStyle.Shadow.ShadowOffsetY = 0.0f; 
       lineStyle.Shadow.ShadowColorCieLabValue = new ushort[3] { 1, 2, 3 }; 
     
       lineStyle.PatternOnColorCieLabValue = new ushort[3] { 24886, 53484, 50171 };   // red 
       lineStyle.PatternOffColorCieLabValue = new ushort[3] { 0, 0, 0 }; 
       lineStyle.LineThickness = 2.0f; 
       lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid; 
       lineStyle.LinePattern = 0xFFFF; 
       lineStyle.PatternOnOpacity = 1.0f; 
       lineStyle.PatternOffOpacity = 0.0f; 
     
       // Create a compound graphic -- ruler0 
       DicomCompoundGraphic ruler0 = new DicomCompoundGraphic(); 
     
       ruler0.LayerName = "Layer 0"; 
       ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel; 
       ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler; 
     
       DicomAnnotationPoint[] pts = new DicomAnnotationPoint[2]; 
       pts[0] = new DicomAnnotationPoint(100, 100); 
       pts[1] = new DicomAnnotationPoint(200, 200); 
       ruler0.SetAnnotationPoints(pts, pts.Length); 
     
       ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId(); 
       ruler0.GraphicGroupId = du.GraphicGroupId; 
       ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId; 
       ruler0.LineStyle = lineStyle.Clone(); 
     
       // Create a compound graphic -- ruler0 
       DicomCompoundGraphic ruler1 = new DicomCompoundGraphic(); 
     
       ruler1.LayerName = "Layer 0"; 
       ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel; 
       ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler; 
     
       pts = new DicomAnnotationPoint[2]; 
       pts[0] = new DicomAnnotationPoint(200, 200); 
       pts[1] = new DicomAnnotationPoint(300, 100); 
       ruler1.SetAnnotationPoints(pts, pts.Length); 
     
       ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId(); 
       ruler1.GraphicGroupId = du.GraphicGroupId; 
       ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId | DicomAnnotationOptions.GraphicGroupId; 
       ruler1.LineStyle = lineStyle.Clone(); 
     
       // Convert the DICOM Annotation to a LEAD annotation 
       List<DicomAnnotationObject> listDicomObjects = new List<DicomAnnotationObject>(); 
       listDicomObjects.Add(ruler0); 
       listDicomObjects.Add(ruler1); 
     
       // Create the DicomDataSet that has the GraphicGroupSequence 
       DicomDataSet dsPre = new DicomDataSet(); 
       DicomElement graphicGroupSequenceElement = dsPre.InsertElement(null, false, DicomTag.GraphicGroupSequence, DicomVRType.SQ, true, 0); 
       DicomElement item = dsPre.InsertElement(graphicGroupSequenceElement, true, DicomTag.Item, DicomVRType.SQ, true, 0); 
       dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupLabel, "PolyRulerObject"); 
       dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicLayerDescription, "LEAD Annotation"); 
       dsPre.InsertElementAndSetValue(item, true, DicomTag.GraphicGroupID, du.GraphicGroupId); 
     
       List<AnnObject> annObjectList = du.ToAnnObject(dsPre, listDicomObjects); 
       return annObjectList; 
    } 
    Imports Leadtools 
    Imports Leadtools.Dicom 
    Imports Leadtools.Dicom.Annotations.Core 
    Imports Leadtools.Annotations.Core 
     
    Private Function DicomAnnotationsUtilities_ToAnnObject2() As List(Of AnnObject) 
       ' Set up the DicomAnnotationsUtilities converter 
       Dim du As New DicomAnnotationsUtilities() 
       du.ImageDpiX = 96.0 
       du.ImageDpiY = 96.0 
       du.DisplayWidth = 200 
       du.DisplayHeight = 200 
       du.LayerName = "Layer 0" 
       du.CompoundGraphicInstanceId = 100 
       du.GraphicGroupId = 123 
     
       ' LineStyle -- user for both rulers 
       Dim lineStyle As New DicomLineStyle() 
       lineStyle = New DicomLineStyle() 
       lineStyle.LineOptions = DicomAnnotationLineOptions.None 
       lineStyle.Shadow.ShadowStyle = DicomAnnotationShadowStyleType.Off 
       lineStyle.Shadow.ShadowOpacity = 0.0F 
       lineStyle.Shadow.ShadowOffsetX = 0.0F 
       lineStyle.Shadow.ShadowOffsetY = 0.0F 
       lineStyle.Shadow.ShadowColorCieLabValue = New UShort(2) {1, 2, 3} 
     
       lineStyle.PatternOnColorCieLabValue = New UShort(2) {24886, 53484, 50171} ' red 
       lineStyle.PatternOffColorCieLabValue = New UShort(2) {0, 0, 0} 
       lineStyle.LineThickness = 2.0F 
       lineStyle.LineDashingStyle = DicomAnnotationDashStyleType.Solid 
       lineStyle.LinePattern = &HFFFF 
       lineStyle.PatternOnOpacity = 1.0F 
       lineStyle.PatternOffOpacity = 0.0F 
     
       ' Create a compound graphic -- ruler0 
       Dim ruler0 As New DicomCompoundGraphic() 
     
       ruler0.LayerName = "Layer 0" 
       ruler0.Units = DicomAnnotationUnitsRelativityType.Pixel 
       ruler0.Type = DicomAnnotationCompoundGraphicType.Ruler 
     
       Dim pts(1) As DicomAnnotationPoint 
       pts(0) = New DicomAnnotationPoint(100, 100) 
       pts(1) = New DicomAnnotationPoint(200, 200) 
       ruler0.SetAnnotationPoints(pts, pts.Length) 
     
       ruler0.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId() 
       ruler0.GraphicGroupId = du.GraphicGroupId 
       ruler0.Options = DicomAnnotationOptions.CompoundGraphicInstanceId Or DicomAnnotationOptions.GraphicGroupId 
       ruler0.LineStyle = lineStyle.Clone() 
     
       ' Create a compound graphic -- ruler0 
       Dim ruler1 As New DicomCompoundGraphic() 
     
       ruler1.LayerName = "Layer 0" 
       ruler1.Units = DicomAnnotationUnitsRelativityType.Pixel 
       ruler1.Type = DicomAnnotationCompoundGraphicType.Ruler 
     
       pts = New DicomAnnotationPoint(1) {} 
       pts(0) = New DicomAnnotationPoint(200, 200) 
       pts(1) = New DicomAnnotationPoint(300, 100) 
       ruler1.SetAnnotationPoints(pts, pts.Length) 
     
       ruler1.CompoundGraphicInstanceId = du.IncrementCompoundGraphicInstanceId() 
       ruler1.GraphicGroupId = du.GraphicGroupId 
       ruler1.Options = DicomAnnotationOptions.CompoundGraphicInstanceId Or DicomAnnotationOptions.GraphicGroupId 
       ruler1.LineStyle = lineStyle.Clone() 
     
       ' Convert the DICOM Annotation to a LEAD annotation 
       Dim listDicomObjects As New List(Of DicomAnnotationObject)() 
       listDicomObjects.Add(ruler0) 
       listDicomObjects.Add(ruler1) 
     
       ' Create the DicomDataSet that has the GraphicGroupSequence 
       Dim dsPre As New DicomDataSet() 
       Dim graphicGroupSequenceElement As DicomElement = dsPre.InsertElement(Nothing, False, DicomTag.GraphicGroupSequence, DicomVRType.SQ, True, 0) 
       Dim item As DicomElement = dsPre.InsertElement(graphicGroupSequenceElement, True, DicomTag.Item, DicomVRType.SQ, True, 0) 
       dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicGroupLabel, "PolyRulerObject") 
       dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicLayerDescription, "LEAD Annotation") 
       dsPre.InsertElementAndSetValue(item, True, DicomTag.GraphicGroupID, du.GraphicGroupId) 
     
       Dim annObjectList As List(Of AnnObject) = du.ToAnnObject(dsPre, listDicomObjects) 
       Return annObjectList 
    End Function 
Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.